package com.chucang.shucang.ttp.messagecenter.strategy.concrete;

import cn.hutool.extra.spring.SpringUtil;
import com.chucang.shucang.common.mq.message.SmsCodeMessage;
import com.chucang.shucang.ttp.messagecenter.enums.MESSAGE_TYPE;
import com.chucang.shucang.ttp.messagecenter.strategy.MessageStrategy;
import com.chucang.shucang.ttp.service.TencentSmsService;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.sms.v20190711.models.SendSmsRequest;
import com.tencentcloudapi.sms.v20190711.models.SendSmsResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * @author flitsneak
 * @email flitsneak@gmail.com
 * @date 2022/9/26 20:44
 * @description 腾讯云短信
 */
@Slf4j
public class TencentSms implements MessageStrategy {

    @Override
    public boolean sendMessage(MESSAGE_TYPE messageType, SmsCodeMessage smsCodeMessage) {
        log.info("调用腾讯云发送短信=======》{}", smsCodeMessage.getSmsCode());
        TencentSmsService tencentSmsService = SpringUtil.getBean(TencentSmsService.class);
        return tencentSmsService.sendMessage(messageType, smsCodeMessage);
    }
}
